﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using Panaglobe.Silverlight.PhotoBrowser.Server;

/// <summary>
/// This is the base class of PhotoAlbumDisplay user control to casting.
/// Without this the list page cannot access properties of loaded user control.
/// </summary>
public class PhotoAlbumDisplayBase : UserControl
{
    /// <summary>
    /// Initializes a new instance of the <see cref="PhotoAlbumDisplayBase"/> class.
    /// </summary>
    public PhotoAlbumDisplayBase() { }

    private AlbumInfo album = null;

    /// <summary>
    /// Gets or sets the album to display.
    /// </summary>
    /// <value>The album to display.</value>
    public AlbumInfo Album
    {
        get { return this.album; }
        set 
        {
            AlbumInfo oldAlbum = this.album;
            if (oldAlbum != value)
            {
                this.album = value;
                this.OnAlbumChanged(oldAlbum, value);
            }
        }
    }

    /// <summary>
    /// Called when the album to display has changed.
    /// </summary>
    /// <param name="oldAlbum">The old album.</param>
    /// <param name="newAlbum">The new album.</param>
    protected virtual void OnAlbumChanged(AlbumInfo oldAlbum, AlbumInfo newAlbum)
    {
        
    }
}
